/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package org.datedemo;

import org.webrx.Var2Demo;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Date;

/**
 * <p>Project: jse2302 - LocalDateTime10
 * <p>Powered by webrx On 2023-06-16 16:41:53
 * <p>Created by IntelliJ IDEA
 *
 * @author  webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class LocalDateTime10 {
    public static void main(String[] args) {
        LocalDate now = LocalDate.now();
        LocalDate n1 = now.minusDays(5);
        LocalDate n2 = n1.plusDays(-10);

        System.out.printf("%tF%n",now);
        System.out.printf("%tF%n",n1);
        System.out.printf("%tF%n",n2);
        System.out.println(n2.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日 E M")));
        System.out.println(n2.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日 EE MM")));
        System.out.println(n2.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日 EEE MMM")));
        System.out.println(n2.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日 EEEE MMMM")));

        LocalTime time = LocalTime.now();
        System.out.printf("%tT%n",time);

        LocalDateTime nn1 = LocalDateTime.now();
        //nn1.toLocalDate().isLeapYear()

        System.out.printf("%tF %<tT %<tA %<tB %<tp%n",nn1);

        //转时间戳
        long n22 = nn1.toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
        System.out.println(n22);
        System.out.printf("%tF %<tT %<tA %<tB %<tp%n",new Date(n22));





    }
}
